---
title: Debugging Teams
sidebarTitle: Debugging Teams
description: Learn how to debug Agno Teams.
---

Agno comes with an exceptionally well-built debug mode that takes your team development experience to the next level. It helps you understand the flow of execution and the intermediate steps. For example:

1. Inspect the messages sent to the model and the response it generates.
2. Trace intermediate steps and monitor metrics like token usage, execution time, etc.
3. Inspect tool calls, errors, and their results.
4. Monitor team member interactions and delegation patterns.

## Debug Mode

To enable debug mode:

1. Set the `debug_mode` parameter on your team, to enable it for all runs, as well as for member runs.
2. Set the `debug_mode` parameter on the `run` method, to enable it for the current run.
3. Set the `AGNO_DEBUG` environment variable to `True`, to enable debug mode for all teams.

```python
from agno.team import Team
from agno.agent import Agent
from agno.models.openai import OpenAIChat

news_agent = Agent(name="News Agent", role="Get the latest news")
weather_agent = Agent(name="Weather Agent", role="Get the weather for the next 7 days")

team = Team(
    name="News and Weather Team",
    members=[news_agent, weather_agent],
    model=OpenAIChat(id="gpt-4o"),
    debug_mode=True,
    # debug_level=2, # Uncomment to get more detailed logs
)

# Run team and print response to the terminal
team.print_response("What is the weather in Tokyo?")
```

<Tip>

You can set `debug_level=2` to get even more detailed logs.

</Tip>

## Interactive CLI

Agno also comes with a pre-built interactive CLI that runs your Team as a command-line application. You can use this to test back-and-forth conversations with your team.

```python
from agno.team import Team
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat

news_agent = Agent(name="News Agent", role="Get the latest news")
weather_agent = Agent(name="Weather Agent", role="Get the weather for the next 7 days")

team = Team(
    name="News and Weather Team",
    members=[news_agent, weather_agent],
    model=OpenAIChat(id="gpt-4o"),
    db=SqliteDb(db_file="tmp/data.db"),
    add_history_to_context=True,
    num_history_runs=3,
)

# Run team as an interactive CLI app
team.cli_app(stream=True)
```

## Developer Resources

- View the [Team reference](/reference/teams/team)
- View [Team Cookbook](https://github.com/agno-agi/agno/tree/main/cookbook/teams/README.md)
